//
//  ArticleCell.swift
//  WanAndroidLearn
//
//  Created by TRS-Mobile on 2023/11/3.
//

import Foundation
import UIKit
import SnapKit
import ReactorKit

class ArticleCell: TableViewBaseCell, View {
    
    func bind(reactor: ArticleListCellReactor) {
        reactor.state
            .map { $0.title }
            .bind(to: titleLabel.rx.text)
            .disposed(by: disposeBag)
    }
    
    typealias Reactor = ArticleListCellReactor
    
    lazy var titleLabel: Label = {
        let label = Label().then {
            $0.font = .systemFont(ofSize: 18)
            $0.numberOfLines = 0
            $0.theme.textColor = themed { $0.text }
        }
        return label
    }()
    
    override func makeUI() {
        super.makeUI()
        containerView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.left.right.equalToSuperview().inset(20)
//            make.centerY.equalToSuperview()
            make.top.bottom.equalToSuperview().inset(15)
            make.height.greaterThanOrEqualTo(30)
        }
    }
}
